package src;

public void run()
{
    thread myThread = new thread();
    Thread thread2 = new Thread(myThread);
    System.out.println("State of thread2 after creating it - "+ thread2.getState());
    thread2.start();
    System.out.println("State of thread2 after calling .start() method on it - " +
            thread2.getState());
    try
    {
        Thread.sleep(200);
    }
    catch (InterruptedException e)
    {
        e.printStackTrace();
    }
    System.out.println("State of thread2 after calling .sleep() method on it - "+
            thread2.getState() );


    try
    {
        thread2.join();
    }
    catch (InterruptedException e)
    {
        e.printStackTrace();
    }
    System.out.println("State of thread2 when it has finished it's execution - " +
            thread2.getState());
}
